#pragma once

#include "space\base_compat.h"

namespace space {

	#pragma region quick-create macros

	#define RESULT_OK		result(result::OK)
	#define RESULT_ERROR	result(result::ERROR_U)
	#define RESULT_NOT_IMPL result(result::NOT_IMPL)
	#define RESULT_NOT_FOUND result(result::NOT_FOUND)
	#define RESULT_ALREADY_EXISTS result(result::ALREADY_EXISTS)

	#pragma endregion

	class result {
	public:
		enum type {
			NOT_IMPL,
			ERROR_U,
			ALREADY_EXISTS,
			NOT_FOUND,
			OK
		};

		#pragma region operators
		
		bool operator==(result &one) {
			if(this->code == one.code) {
				return true;
			} else {
				return false;
			}
		}
		bool operator!=(result &one) {
			if(this->code != one.code) {
				return true;
			} else {
				return false;
			}
		}

		result& operator=(result &in) {
			this->code = in.code;
			this->value = in.value;

			return *this;
		}

		#pragma endregion

		#pragma region constructors
		result(type a_code) {
			code = a_code;
		}
		result(type a_code, u_int a_value) {
			this->code = a_code;
			this->value = a_value;
		}
		#pragma endregion

		type code;
		u_int value;
		char *extended_value;
	};

};